﻿using System;

namespace Edge.Business.Domain
{
    public interface IEntityLoader
    {
        /// <summary>
        /// load entity by id
        /// throws exception if object does not exists
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        object Load(Type type, object id);
        /// <summary>
        /// load entity by id
        /// throws exception if object does not exists
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="IT"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        T Load<T, IT>(IT id);
        /// <summary>
        /// load entity by id
        /// retunr null if object does not exists
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        object Get(Type type, object id);

        /// <summary>
        /// load entity by id
        /// retunr null if object does not exists
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="IT"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        T Get<T, IT>(IT id);
    }
}